home *** CD-ROM | disk | FTP | other *** search
- :done
- @d = fopeni("welcome.txt", "t") {open welcome message file }
- if ( @d = -1 ) goto :command {no welcome file found }
- "$0d$0a"
- {send welcome file to caller}
-
- :loop2
- @a=fgets("welcome.txt")
- if ( @a <> -1 ) "@a$0d$0a" {if is equal -1 means EOF met}
- if ( @a <> -1 ) goto :loop2
- fclosei("welcome.txt")
-
- :quit
- typecr("LOGON OK");
- { Main command loop. Lets caller enter all DOS commands except FORMAT }
- { and RENAME }
- :command
- twait(2,"sec");
- "$0d$0a"
- "Type ""FILE"" for file transfer, ""DIR <path>"" for file list, ""BYE"" to quit:$0d$0a"
- @a=getline
- @a=toupper(@a)
- if ( @a = "") goto :command
- if ( substr(@a, 1, 3) = "BYE" ) goto :leave
- if ( substr(@a, 1, 4) = "FILE" ) goto :filetrans
- if ( substr(@a, 1, 3) = "DIR" ) goto :dirfile
- goto :command
-
- :nofile
- "$0d$0a"
- "No file"
- "$0d$0a"
- goto :command
-
- :dirfile
- @n = 0
- if ( substr(@a, 4, 40) = "" ) goto :dirfile1
- @g = substr(@a, 5, 40)
- if (substr(@g, strlen(@g), 1) = "\") @g = concat(@g, "*.*")
-
- :dirfile2
- @f = FINDFIRST("@g")
- if (@f = -1) goto :nofile
- goto :donext
-
- :dirfile1
- @f = FINDFIRST("*.*")
- if (@f = -1) goto :nofile
- :donext
- "@f"
- "$0d$0a"
- @n = expr(@n + 1)
- @f = findnext
- if (@f = -1) goto :command
- if (@n >20) goto :plist
- goto :donext
-
- :plist
- @n = 0
- "Pause, press enter to continue"
- @a=getline
- "$0d$0a"
- goto :donext
-
-
- :filetrans
- "$0d$0a"
- "Do you want to use Xmodem_Check[S]um, Xmodem_[C]RC, Xmodem_[1],"
- "$0d$0a[X]modem_1K_G, Ymodem_[G], [Y]modem, [K]ermit, [Z]modem or [Q]uit?"
- "$0d$0a(S/C/1/X/G/Y/K/Z/Q):$0d$0a"
- @a = getline
- @a = toupper(@a)
- @p = " "
- @b = 0
- if ( substr(@a, 1, 1) = "S" ) @p = "Xmodem"
- if ( substr(@a, 1, 1) = "S" ) @b = 1
- if ( substr(@a, 1, 1) = "C" ) @p = "Xmodem"
- if ( substr(@a, 1, 1) = "C" ) @b = 2
- if ( substr(@a, 1, 1) = "1" ) @p = "Xmodem"
- if ( substr(@a, 1, 1) = "1" ) @b = 3
- if ( substr(@a, 1, 1) = "X" ) @p = "Xmodem"
- if ( substr(@a, 1, 1) = "X" ) @b = 4
- if ( substr(@a, 1, 1) = "G" ) @p = "Ymodem"
- if ( substr(@a, 1, 1) = "G" ) @b = 1
- if ( substr(@a, 1, 1) = "Y" ) @p = "Ymodem"
- if ( substr(@a, 1, 1) = "Y" ) @b = 2
- if ( substr(@a, 1, 1) = "K" ) @p = "Kermit"
- if ( substr(@a, 1, 1) = "Z" ) @p = "Zmodem"
- if ( substr(@a, 1, 1) = "Q" ) goto :command
- if ( substr(@p, 1, 1) = " " ) goto :filetrans
- "$0d$0aWant [D]ownload, [U]pload file or [Q]uit? (D/U/Q):$0d$0a"
- @a = getline
- @a=toupper(@a)
- if ( substr(@a, 1, 1) = "D" ) goto :fname1
- if ( substr(@a, 1, 1) = "U" ) goto :fname2
- if ( substr(@a, 1, 1) = "Q" ) goto :command
- goto :filetrans
-
- :fname1
- "$0d$0a"
- "Enter ""STOP"" to stop received file."
- :fname1_2
- "$0d$0a"
- "What file name do you want to receive from the host? "
- { ":>" }
- "$0d$0a"
- @f = getline
- @f = toupper(@f)
- if ( @f = "STOP") goto :command
-
- :dosend
- "$0d$0a"
- "Would you like to logout after the file transfer?(Y/N)"
- "$0d$0a"
- @l = getline
-
- "$0d$0aGet ready to receive @p file...$0d$0a"
- if ( @p = "Xmodem") goto :dosend_modem
- if ( @p = "Ymodem") goto :dosend_modem
- if ( @p = "Zmodem") goto :dosend_modem
- if ( @p = "Kermit") goto :dosend_kermit
- goto :dosend_finished
- :dosend_modem
- Sendfile("@f", "@p", @b);
- goto :dosend_finished
- :dosend_kermit
- Kersend(@f)
- goto :dosend_finished
- :dosend_finished
- twait(1,"sec");
- @l = toupper(@l)
- if ( substr(@l, 1, 1) = "Y" ) goto :leave
- goto :filetrans
-
- :fname2
- "$0d$0a"
- if (@p = "Xmodem") goto :fname2_modem
- if (@p = "Ymodem") goto :fname2_modem
- if (@p = "Zmodem") goto :fname2_modem
- if (@p = "Kermit") goto :fname2_kermit
- goto :dosend_finished
- :fname2_modem
- "Enter name of file to send to host: "
- "$0d$0a"
- @f = getline
- "$0d$0a"
- "Would you like to logout after the file transfer?(Y/N)"
- "$0d$0a"
- @l = getline
-
- "$0d$0aGet ready to send @p file...$0d$0a"
- Recvfile("@f", "@p", @b);
- twait(1,"sec");
- @l = toupper(@l)
- if ( substr(@l, 1, 1) = "Y" ) goto :leave
- goto :filetrans
- :fname2_kermit
- "$0d$0a"
- "Would you like to logout after the file transfer?(Y/N)"
- "$0d$0a"
- @l = getline
- "$0d$0aGet ready to send @p file...$0d$0a"
- Kerrecv
- twait(1,"sec");
- @l = toupper(@l)
- if ( substr(@l, 1, 1) = "Y" ) goto :leave
- :fname2_finished
- goto :filetrans
-
- :badcommand
- "$0d$0a@a Command Not Allowed"
- goto :command
-
- :leave
- typecr("Hang up the phone...");
- hangup
- typecr("Restart...");
- goto :abort
-
- :abort
- exit